<template>
  <div id="app">
    <el-container>
      <el-header>
        <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
          <el-menu-item index="/index">首页</el-menu-item>
          <el-submenu index="/shop">
            <template slot="title">商品管理</template>
            <el-menu-item index="/shop">商品信息</el-menu-item>
            <el-menu-item index="/shopImg">商品图片信息</el-menu-item>
            <el-menu-item index="/add">添加商品</el-menu-item>
          </el-submenu>
          <el-menu-item index="/order">订单管理</el-menu-item>
<!--          <el-menu-item index="/login" style="text-align: right">登录</el-menu-item>-->
        </el-menu>
        <div class="line"></div>
      </el-header>

      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'App',

  data() {
    return {
      activeIndex: this.$route.path,
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      this.$router.push(key);
    },
  },

}
</script>

<style>

</style>
